//
//  YMUtil.h
//  MyProject
//
//  Created by Pei on 16/6/19.
//  Copyright © 2016年 Xiaobo Pei. All rights reserved.
//
#import <Foundation/Foundation.h>

@interface YMUtil : NSObject

//判断是否数字
+ (BOOL) isValidNumber:(NSString*)value;

//判断是否手机号
+ (BOOL) isValidPhone:(NSString*)value;

//校验邮箱
+ (BOOL) validateEmail:(NSString *)candidate;

//获取应用版本号
+ (NSString*)getVersion;

//获取设备型号
+ (NSString*)getDeviceNo;

//手机号格式化，显示前三位后四位，中间以星号代替
+ (NSString*)phoneFormat:(NSString*)phone;

//判断UITextField为空或空格
+ (BOOL)validateTextField:(UITextField*)textField;

//判断UITextField是否为8-20位密码
+ (BOOL)validateTextFieldPassword:(UITextField *)textField;

//根据身份证号判断性别
+ (NSString *)JudgmentIsManOrWomanThroughID:(NSString *)cardId;

//根据身份证号判断出生年月日
+ (NSString *)JudgmentDateThroughID:(NSString *)cardId;

//根据id判断证件类型
+ (NSString *)cardTypeChooseFromId:(NSString *)numberId;

//字符串转nsdate
+ (NSDate *)dateFromString:(NSString *)dateStr;

//nsdate转字符串
+ (NSString*)timeToString:(NSDate *)time;

//判断NSString为空或空格
+ (BOOL)validateText:(NSString *)text ;


//NSString与UIImage相互转换
+ (UIImage*)stringToImage:(NSString*)source;
+ (NSString*)imageToString:(UIImage*)source;

//获取NSDate前后几个月的NSDate
+ (NSDate *)getPriousorLaterDateFromDate:(NSDate *)date withMonth:(int)month;

//获取nsdate的年月日
+(int)GetDay:(NSDate *)date;
+(int)GetMonth:(NSDate *)date;
+(int)GetYear:(NSDate *)date;

//通过数字获取相应月份
+(NSString*)getMonthString:(int)month;

//获取指定范围的字符串
+(NSString *)getStringWithRange:(NSString *)str Value1:(NSInteger)value1 Value2:(NSInteger )value2;

//判断是否在地区码内
+(BOOL)areaCode:(NSString *)code;

//判断身份证号是否合法
+(BOOL)Chk18PaperId:(NSString *)sPaperId;

//获取随机数，用于生成传输密钥
+ (NSString*)randomString;

//add by peixb 产生4位随机数，生成一维码支付的时候，放在CUST_NO后面
+ (NSString *)createFourRandom;


//类型识别:将所有的NSNull类型转化成@""
+(id)changeType:(id)myObj;


@end
